<?php

namespace App\Policies;

use App\Http\Models\User;
use App\Http\Models\Post;
use Illuminate\Auth\Access\HandlesAuthorization;

class PostPolicy
{
    use HandlesAuthorization;

    /**
     * Create a new policy instance.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }

//    权限管理
    public function update ( User $user,Post $post )
    {
//        dd($post->user_id,$user->id);
        return $user->id == $post->user_id;
    }

    public function del ( Post $post,User $user )
    {
        return $post->user_id === $user->id;
    }
}
